﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Common.OpenXml
{
	/// <summary>
    /// Provides a standard way to access the namespace URIs for the Open XML document namespaces.
    /// Also provides a preconstructed namespace manager for the namespaces and prefixes.
    /// </summary>
	public static class Namespaces
	{
		// Standard Open XML Namespace URIs
        public const string SpreadsheetML = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
        public const string SpreadsheetDrawing = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing";
        public const string Relationships = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
        public const string DrawingML = "http://schemas.openxmlformats.org/drawingml/2006/main";
        public const string ChartML = "http://schemas.openxmlformats.org/drawingml/2006/chart";
		public const string DocPropVTType = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes";

        #region Namespace Manager Methods
        private static XmlNamespaceManager m_namespaceManager = new XmlNamespaceManager(new NameTable());

        /// <summary>
        /// Initializes the namespace manager with all of the Open XML document namespaces.
        /// </summary>
		static Namespaces()
        {
            // add each namespace to the namespace manager
			m_namespaceManager.AddNamespace(Prefixes.SpreadsheetML, Namespaces.SpreadsheetML);
			m_namespaceManager.AddNamespace(Prefixes.SpreadsheetDrawing, Namespaces.SpreadsheetDrawing);
			m_namespaceManager.AddNamespace(Prefixes.Relationships, Namespaces.Relationships);
			m_namespaceManager.AddNamespace(Prefixes.DrawingML, Namespaces.DrawingML);
			m_namespaceManager.AddNamespace(Prefixes.ChartML, Namespaces.ChartML);
            m_namespaceManager.AddNamespace(Prefixes.VTType, Namespaces.DocPropVTType);
        }

        /// <summary>
        /// Returns the static namespace manager 
        /// </summary>
        public static XmlNamespaceManager NamespaceManager
        {
            get { return m_namespaceManager; }
        }
        #endregion
	}
}
